package com.cdks.wuxiu.api.service.mysql;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdks.wuxiu.api.component.constant.Constant;
import com.cdks.wuxiu.api.mapper.CommentTopicInfoMapper;
import com.cdks.wuxiu.api.model.dto.CommentTopicInfoDTO;
import com.cdks.wuxiu.entity.mysql.CommentTopicInfo;

import java.util.List;

import org.springframework.stereotype.Service;

/**
 * 评论主题信息 服务实现类
 */
@Service
public class CommentTopicInfoServiceImpl extends ServiceImpl<CommentTopicInfoMapper, CommentTopicInfo> implements CommentTopicInfoService {

    @Override
    public List<CommentTopicInfoDTO> getList(Long userId, Long destId, Integer destType, Integer type, Integer page) {
        List<CommentTopicInfoDTO> topicList  = null;

        switch (type)
        {
            case Constant.REPLY_LIST_ALL:
            {
                topicList  = baseMapper.getListAll(userId, destId, destType, page * Constant.LIST_PAGE_SIZE, Constant.LIST_PAGE_SIZE);
                break;
            }

            case Constant.REPLY_LIST_MINE:
            {
                topicList  = baseMapper.getListMine(userId, destId, destType, page * Constant.LIST_PAGE_SIZE, Constant.LIST_PAGE_SIZE);
                break;
            }

            default:
            {
                break;
            }
        }

        return topicList;
    }

    @Override
    public int addReplyCount(long topicId) {
        return baseMapper.addReplyCount(topicId);
    }
}
